<template>
	<div class="bd">
		<p>computed:</p>
		<p>{{ count }}</p>
		<p>{{ plusOne }}</p>
	</div>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue';

const count = ref(1);
const plusOne = computed({
	get() {
		return count.value + 1;
	},
	set(val) {
		count.value = val - 1;
	},
});

// TODO 这里赋值后，plusOne已经是赋值后的数据，所以在set中的val一斤是改变后的值
plusOne.value += 3;
</script>
